package com.example.mapboxdemo;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import com.mapbox.geojson.Point;
import com.mapbox.maps.CameraOptions;
import com.mapbox.maps.MapView;
import com.mapbox.maps.MapboxMap;
import com.mapbox.maps.Style;

public class FlayActivity extends AppCompatActivity {
    private MapView mapView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_flay);

        mapView = findViewById(R.id.flyMapView);
        Button button=findViewById(R.id.fly);
        mapView.getMapboxMap().loadStyleUri(Style.TRAFFIC_NIGHT, new Style.OnStyleLoaded() {
            @Override
            public void onStyleLoaded(@NonNull Style style) {
            button.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    MapboxMap mapboxMap=mapView.getMapboxMap();
                    CameraOptions cameraOptions=new CameraOptions.Builder().center(Point.fromLngLat(35.5,60.0)).bearing(180.0).pitch(50.0).zoom(12.0).build();
                    mapboxMap.setCamera(cameraOptions);
                }
            });

            }
        });
    }
}